package com.lovi.thread_;

/**
 * 体会静态代理
 */
public class Test03 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        ThreadProxy threadProxy = new ThreadProxy(dog);
        threadProxy.start();

    }
}
//模拟最简单的Thread类
class ThreadProxy implements Runnable {
    Runnable target;

    public ThreadProxy(Runnable target){
        this.target = target;
    }
    @Override
    public void run() {
        if(target!=null){
            target.run();
        }
    }

    public synchronized void start() {
        start0();
    }
    public void start0(){
        run();
    }

}
